package com.tencent.elife.asyn;

/**
 * @Description 异步操作完成后的回调
 * @author zijianlu
 */
public abstract class DataResponse<T> implements Runnable, Cloneable {

    public T result;

    public int arg1;

    public Object arg2;

    public Object arg3;

    public int errCode;

    public void setArg1(int arg1) {
        this.arg1 = arg1;
    }

    public void setArg2(Object arg2) {
        this.arg2 = arg2;
    }

    public void setArg3(Object arg3) {
        this.arg3 = arg3;
    }

    @Override
    public void run() {
        onResponse(result, arg1, arg2, arg3);
    }

    /** 异步操作正常完成后的回调函数，在UI线程中执行 */
    public abstract void onResponse(final T result, final int arg1,
        final Object arg2, final Object arg3);

    /** 异步操作出现异常后的回调函数，在UI线程中执行 */
    public void onError(final int errorCode, final String errorInfo,
        final Command<?> cmd, final BaseManager manager) {

    }
}